package com.coincalf.wallet.feign;

import com.coincalf.framework.dto.CoinWithdrawDTO;
import com.coincalf.framework.dto.TransInfoDTO;
import com.coincalf.framework.dto.WithdrawResultDTO;
import com.coincalf.wallet.feign.hystrix.CoinWithdrawServiceClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * @Description:
 * @Author: Chen Long
 * @Date: Created in 2018/5/21 下午9:27
 * @Modified by: Chen Long
 */
@FeignClient(value = "coincalf-wallet-service", fallback = CoinWithdrawServiceClientFallback.class)
public interface CoinWithdrawServiceClient {

    /**
     * 查询提现列表
     *
     * @return
     */
    @RequestMapping(value = "/withdraw/pending", method = RequestMethod.GET)
    List<CoinWithdrawDTO> queryPendingRecord();

    /**
     * 根据币种名称查询提现列表
     *
     * @return
     */
    @RequestMapping(value = "/withdraw/pending/{coinName}", method = RequestMethod.GET)
    List<CoinWithdrawDTO> queryPassedRecordByCoinName(@PathVariable("coinName") String coinName);

    /**
     * 修改提现记录状态
     *
     * @param coinWithdraw
     * @return
     */
    @RequestMapping(value = "/withdraw/success", method = RequestMethod.PUT)
    boolean modifyWithdrawStatus(@RequestBody CoinWithdrawDTO coinWithdraw);

    /**
     * 提币申请
     *
     * @param coinWithdraw
     * @return
     */
    @RequestMapping(value = "/withdraw", method = RequestMethod.POST)
    Long applyWithdraw(@RequestBody CoinWithdrawDTO coinWithdraw);

    //执行链上转账
    @RequestMapping(value = "/withdraw/sendCoin", method = RequestMethod.POST)
    TransInfoDTO sendCoin(@RequestBody TransInfoDTO transInfo);

    //修改提币交易状态
    @RequestMapping(value = "/withdraw/updateTxStatus", method = RequestMethod.POST)
    public boolean updateTxStatus(@RequestBody WithdrawResultDTO withdrawResultDTO);

    /**
     * 根据币种名称查询提现列表
     *
     * @return
     */
    @RequestMapping(value = "/withdraw/sendCoining/{coinName}", method = RequestMethod.GET)
    List<CoinWithdrawDTO> querySendCoiningByCoinName(@PathVariable("coinName") String coinName);


}
